{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 3c. Calculate fO2 from melt ST for analyses in a csv file using user specified options\n", "\n", "What if I don't want to use the default options..." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Python set-up\n", "First we need to import a few Python packages (including VolFe) and set the precision of the calculations. You need to install VolFe once on your machine, if you haven't yet, uncomment the line below (remove the #)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Install VolFe on your machine. Remove the # from line below to do this (don't remove the # from this line!).\n", "# pip install VolFe" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# import python packages\n", "import pandas as pd\n", "import VolFe as vf" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Define the inputs\n", "\n", "In that case, we create a dataframe telling VolFe what to use instead. There are lots of options that can be changed, which can be viewed below. " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Help on function make_df_and_add_model_defaults in module VolFe.model_dependent_variables:\n", "\n", "make_df_and_add_model_defaults(models)\n", " Converts user-provided model configurations (e.g. ['carbon dioxide','MORB_Dixon95'],['hydrogen sulfide','basaltic andesite']\n", " into a structured pandas DataFrame, combined with default options for anything not specified\n", "\n", "\n", " Parameters\n", " ----------\n", " models : list of [str, str]\n", " A list of lists, where each inner list contains two elements: the model type (str)\n", " and the user-specified option (str) for that model type.\n", "\n", " Returns\n", " -------\n", " pandas.DataFrame\n", " A DataFrame where the first column is 'type', set as the index, and the second column\n", " is 'option', containing the user-specified option or the default option if none is provided.\n", "\n", "\n", " Model Parameters and Options\n", " ---------------------------------\n", " The following parameters can be overridden in models.\n", " Any parameter can be set to 'setup', in which case the parameter is specified in the setup dataframe instead.\n", "\n", "\n", " ### Specifying species ###\n", "\n", " COH_species: Specifying what COH species are present in the melt and vapor.\n", " default: 'yes_H2_CO_CH4_melt' Include H2mol (if H present), COmol (if C present) and/or CH4mol (if H and C present) as dissolved melt species.\n", " Other options:\n", " 'no_H2_CO_CH4_melt' H2, CO and/or CH4 are insoluble in the melt but they are still present in the vapor (H2 in the vapor if H present, CO in the vapor if C present, CH4 in the vapor if both H and C present).\n", " 'H2O-CO2 only' The only species present in the vapor are H2O and CO2 and in the melt are H2OT and CO2T (i.e., no CO, H2, and/or CH4 in the melt or vapor).\n", "\n", " H2S_m: Is H2S a dissolved melt species.\n", " default 'True' Include H2Smol as a dissolved melt species.\n", " Other options:\n", " 'False' H2Smol is insoluble in the melt.\n", "\n", " species X: Chemical identity of species X, which defines its atomic mass.\n", " default 'Ar' Species X is argon (i.e., atomic mass of ~40).\n", " Other options:\n", " 'Ne' Species X is Ne (i.e., atomic mass of ~20).\n", " Other noble gases not currently supported, but we can add them if you get in touch!\n", "\n", " ### Hspeciation: default 'none' Oxidised H in the melt only occurs as H2O species (i.e., no OH-).\n", " Other options:\n", " WORK IN PROGRESS\n", "\n", "\n", " ### Oxygen fugacity ###\n", "\n", " fO2: Model for parameterisation of relationship between fO2 and Fe3+/FeT\n", " default: 'Kress91A' Eq. (A-5, A-6) in Kress and Carmichael (1991) CMP 108:82-92 doi:10.1007/BF00307328\n", " Other options:\n", " 'Kress91' Eq. (7) in Kress and Carmichael (1991) CMP 108:82-92 doi:10.1007/BF00307328\n", " 'ONeill18' Eq. (9a) in O'Neill et al. (2018) EPSL 504:152-162 doi:10.1016/j.epsl.2018.10.0020012-821X\n", " 'Borisov18' Eq. (4) from Borisov et al. (2018) CMP 173:98 doi:10.1007/s00410-018-1524-8\n", "\n", " NNObuffer: Model for the parameterisation for the fO2 value of the NNO buffer.\n", " default: 'Frost91' Frost (1991) in \"Oxide Minerals: Petrologic and Magnetic Significance\" doi:10.1515/9781501508684-004\n", " Only one option available currently, included for future development.\n", "\n", " FMQbuffer: Model for the parameterisation for the fO2 value of the FMQ buffer.\n", " default: 'Frost91' FM[beta]Q in Table 1 of Frost (1991) in \"Oxide Minerals: Petrologic and Magnetic Significance\" doi:10.1515/9781501508684-004\n", " Other options:\n", " 'ONeill87' O'Neill (1897) AmMin 72(1-2):67-75\n", "\n", "\n", " ### Models for solubility and speciation constants ###\n", "\n", " carbon dioxide: Model for the parameterisation of the CO2T solubility constant.\n", " default: 'MORB_Dixon95' Bullet (5) of summary from Dixon et al. (1995) JPet 36(6):1607-1631 doi:10.1093/oxfordjournals.petrology.a037267\n", " Other options:\n", " 'Basalt_Dixon97' Eq. (7) from Dixon et al. (1997) AmMin 82(3-4)368-378 doi:10.2138/am-1997-3-415\n", " 'NorthArchBasalt_Dixon97' Eq. (8) from Dixon et al. (1997) AmMin 82(3-4)368-378 doi:10.2138/am-1997-3-415\n", " 'Basalt_Lesne11' Eq. (25,26) from Lesne et al. (2011) CMP 162:153-168 doi:10.1007/s00410-010-0585-0\n", " 'VesuviusAlkaliBasalt_Lesne11' VES-9 in Table 4 from Lesne et al. (2011) CMP 162:153-168 doi:10.1007/s00410-010-0585-0\n", " 'EtnaAlkaliBasalt_Lesne11' ETN-1 in Table 4 from Lesne et al. (2011) CMP 162:153-168 doi:10.1007/s00410-010-0585-0\n", " 'StromboliAlkaliBasalt_Lense11' PST-9 in Table 4 from Lesne et al. (2011) CMP 162:153-168 doi:10.1007/s00410-010-0585-0\n", " 'SunsetCraterAlkaliBasalt_Allison19' Sunset Crater in Table 4 from Allison et al. (2019) CMP 174:58 doi:10.1007/s00410-019-1592-4\n", " 'SVFVBasalticAndesite_Allison19' SVFV in Table 4 from Allison et al. (2019) CMP 174:58 doi:10.1007/s00410-019-1592-4\n", " 'ErebusPhonotephrite_Allison19' Erebus in Table 4 from Allison et al. (2019) CMP 174:58 doi:10.1007/s00410-019-1592-4\n", " 'VesuviusPhonotephrite_Allison19' Vesuvius in Table 4 from Allison et al. (2019) CMP 174:58 doi:10.1007/s00410-019-1592-4\n", " 'EtnaTrachybasalt_Allison19' Etna in Table 4 from Allison et al. (2019) CMP 174:58 doi:10.1007/s00410-019-1592-4\n", " 'StromboliAlkaliBasalt_Allison19' Stromboli in Table 4 from Allison et al. (2019) CMP 174:58 doi:10.1007/s00410-019-1592-4\n", " 'Basanite_Holloway94' Basanite in Table 5 from Holloway and Blank (1994) RiMG 30:187-230 doi:10.1515/9781501509674-012\n", " 'Leucitite_Thibault94' Leucitite from Thibault & Holloway (1994) CMP 116:216-224 doi:10.1007/BF00310701\n", " 'TholeiiteBasalt_Allison22' N72 basalt in Table 2 from Allison et al. (2022) CMP 177:40 doi:10.1007/s00410-022-01903-y\n", " 'Rhyolite_Blank93' Fig.2 caption from Blank et al. (1993) EPSL 119:27-36 doi:10.1016/0012-821X(93)90004-S\n", "\n", " ### water: Model for the parameterisation for the H2O solubility constant.\n", " default: 'Basalt_Hughes24' Hughes et al. (2024) AmMin 109(3):422-438 based on data compiliation from Allison et al. (2022) CMP 177(3):40 doi:10.1007/s00410-022-01903-y\n", " Other options:\n", " 'Rhyolite_HughesIP' Fig.SX from Hughes et al. (in prep) based on data in Fig. 3 of Blank et al. (1993)\n", "\n", " hydrogen: Model for the parameterisation of the H2 solubility constant.\n", " default: 'Basalt_Hughes24' Basalt H2 in Table S4 from Hughes et al. (2024) AmMin 109(3):422-438 doi:10.2138/am-2023-8739\n", " Other options:\n", " 'Andesite_Hughes24' Andesite H2 in Table S4 from Hughes et al. (2024) AmMin 109(3):422-438 doi:10.2138/am-2023-8739\n", "\n", " sulfide: Model for the parameterisation for the *S2- solubility constant (all calibrated over wide range of silicate melt compositions).\n", " default: 'ONeill21dil' Eq. (10.34) inc. H2O dilution from O'Neill (2021) in \"Magma Redox Geochemistry\" doi:10.1002/9781119473206.ch10\n", " Other options:\n", " 'ONeill21' Eq. (10.34) ex. H2O dilution from O'Neill (2021) in \"Magma Redox Geochemistry\" doi:10.1002/9781119473206.ch10\n", " 'ONeill21hyd' (hydrous) Eq. (10.34, 10.49) from O'Neill (2021) in \"Magma Redox Geochemistry\" doi:10.1002/9781119473206.ch10\n", " 'Boulliung23eq6' Eq. (6) from Boulliung & Wood (2023) CMP 178:56 doi:10.1007/s00410-023-02033-9\n", " 'Boulliung23eq7' Eq. (7) from Boulliung & Wood (2023) CMP 178:56 doi:10.1007/s00410-023-02033-9\n", "\n", " sulfate: Model for the parameterisation of the S6+ solubility constant (all calibrated over wide range of silicate melt compositions).\n", " default: 'ONeill22dil' Eq. (12a) inc. H2O dilution from O'Neill & Mavrogenes (2022) GCA 334:368-382 10.1016/j.gca.2022.06.020\n", " Other options:\n", " 'ONeill22' Eq. (12a) without H2O dilution from O'Neill & Mavrogenes (2022) GCA 334:368-382 doi:10.1016/j.gca.2022.06.020\n", " 'Boulliung22nP' (no P-dependence) Eq. (5) from Boulliung & Wood (2023) GCA 343:420 doi:10.1016/j.gca.2022.11.025\n", " 'Boulliung22wP' (inc. P-dependece) Eq. (5) from Boulliung & Wood (2023) GCA 343:420 doi:10.1016/j.gca.2022.11.025 and Eq. (8) for P from Boulliung & Wood (2022) GCA 336:150-164 doi:10.1016/j.gca.2022.08.032\n", " 'Boulliung23eq9' Eq. (9) from Boulliung & Wood (2023) CMP 178:56 doi:10.1007/s00410-023-02033-9\n", " 'Boulliung23eq11' Eq. (11) from Boulliung & Wood (2023) CMP 178:56 doi:10.1007/s00410-023-02033-9\n", "\n", " hydrogen sulfide: Model for the parameterisation for the H2S solubility constant.\n", " default 'Basalt_Hughes24' Fig.S6 from Hughes et al. (2024) AmMin 109(3):422-438 doi:10.2138/am-2023-8739\n", " Other options:\n", " 'BasalticAndesite_Hughes24' Fig.S6 from Hughes et al. (2024) AmMin 109(3):422-438 doi:10.2138/am-2023-8739\n", "\n", " methane: Model for the parameterisation of the CH4 solubility constant.\n", " default: 'Basalt_Ardia13' Eq. (7a) from Ardia et al. (2013) GCA 114:52-71 doi:10.1016/j.gca.2013.03.028\n", " Only one option available currently, included for future development.\n", "\n", " carbon monoxide: Model for the parameterisation of the CO solubility constant.\n", " default: 'Basalt_Hughes24' CO in Table S4 from Hughes et al. (2024) AmMin 109(3):422-438 doi:10.2138/am-2023-8739\n", " Only one option available currently, included for future development.\n", "\n", " species X solubility: Model for the parameterisation of the X solubility constant.\n", " default: 'Ar_Basalt_HughesIP' Hughes et al. (in prep) based on data from Iacono-Marziano et al. (2010) Chemical Geology 279(3–4):145-157\n", " Other options:\n", " Ar_Rhyolite_HughesIP: Hughes et al. (in prep) based on data from Iacono-Marziano et al. (2010) Chemical Geology 279(3–4):145-157\n", " Ne_Basalt_HughesIP: Hughes et al. (in prep) based on data from Iacono-Marziano et al. (2010) Chemical Geology 279(3–4):145-157\n", " Ne_Rhyolite_HughesIP: Hughes et al. (in prep) based on data from Iacono-Marziano et al. (2010) Chemical Geology 279(3–4):145-157\n", "\n", " Cspeccomp: Model for the parameterisation of the speciation constant for CO2mol and CO32- in the melt.\n", " default: 'Basalt' Assume all oxidised carbon in the melt is present as carbonate ions.\n", " Other options:\n", " Andesite_Botcharnikov06: Eq. (8) from Botcharnikov et al. (2006) Chem.Geol. 229(1-3)125-143 doi:10.1016/j.chemgeo.2006.01.016\n", " Dacite_Botcharnikov06: Botcharnikov et al. (2006) Chem.Geol. 229(1-3)125-143 doi:10.1016/j.chemgeo.2006.01.016\n", " Rhyolite: Assume all oxidised carbon in the melt is present as molecular CO2.\n", "\n", " Hspeccomp: Model for the parameterisation of the speciation constant for H2Omol and OH- in the melt, either assuming ideal or regular solution models.\n", " default: 'MORB_HughesIP' [ideal solution only] Eq. SX in Hughes et al. (in prep)\n", " Other options:\n", " MORB_Dixon95: [regular solution only] Table 5 of Dixon et al. (1995) JPet 36(6):1607-1631 doi:10.1093/oxfordjournals.petrology.a037267\n", " AlkaliBasalt_Lesne10: [regular solution only] Eq. (24-27) Lesne et al. (2010) CMP 162:133-151 doi:10.1007/s00410-010-0588-x\n", " StromboliAlkaliBasalt_Lesne10: Eq. (15) [ideal solution] or PST-9 in Table 5 [regular solution] from Lesne et al. (2010) CMP 162:133-151 doi:10.1007/s00410-010-0588-x\n", " VesuviusAlkaliBasalt_Lesne10: Eq. (16) [ideal solution] or VES-9 in Table 5 [regular solution] from Lesne et al. (2010) CMP 162:133-151 doi:10.1007/s00410-010-0588-x\n", " EtnaAlkaliBasalt_Lesne10: Eq. (17) [ideal solution] or ETN-1 in Table 5 [regular solution] from Lesne et al. (2010) CMP 162:133-151 doi:10.1007/s00410-010-0588-x\n", " Andesite_Botcharnikov06: [ideal solution only] Eq (7) from Botcharnikov et al. (2006) Chem. Geol. 229(1-3)125-143 doi:10.1016/j.chemgeo.2006.01.016\n", " Albite_Silver89: Fig. 8 [ideal solution only] or in the text [regular solution] from Silver & Stolper (1989) J.Pet 30(3)667-709 doi:10.1093/petrology/30.3.667\n", " Rhyolite_Zhang97: [ideal solution only] Eq. (9) from Zhang et al. (1997) GCA 61(15):3089-3100 doi:10.1016/S0016-7037(97)00151-8\n", "\n", "\n", " ### Saturation conditions ###\n", "\n", " SCSS: Model for parameterisation of the sulfide content at sulfide saturation (S2-CSS).\n", " default: 'ONeill21hyd' Eq. (10.34, 10.43, 10.45, 10.46, 10.49) from O'Neill (2021) in \"Magma Redox Geochemistry\" doi:10.1002/9781119473206.ch10\n", " Other options:\n", " 'ONeill21' Eq. (10.34, 10.43, 10.45, 10.46) excluding water dilution from O'Neill (2021) in \"Magma Redox Geochemistry\" doi:10.1002/9781119473206.ch10\n", " 'ONeill21dil' Eq. (10.34, 10.43, 10.45, 10.46) including water dilution from O'Neill (2021) in \"Magma Redox Geochemistry\" doi:10.1002/9781119473206.ch10\n", " 'Liu07' Eq. (9) in Liu et al. (2007) GCA 71:1783-1799 doi:10.1016/j.gca.2007.01.004\n", " 'Fortin15' Eq. (7) Fortin et al. (2015) GCA 160:100-116 doi:10.1016/j.gca.2015.03.022\n", " 'Liu21' Eq. (2) Liu et al. (2021) Chem.Geol. 559:119913 doi:10.1016.j.chemgeo.2020.119913\n", " 'Fortin15_pss' Fortin et al. (2015) using PySulfSat by Wieser & Gleeson (2023) Volcanica 6(1):107-127 doi:10.30909/vol.06.01.107127\n", " 'Liu21_pss' Liu et al. (2021) using PySulfSat by Wieser & Gleeson (2023) Volcanica 6(1):107-127 doi:10.30909/vol.06.01.107127\n", " 'ONeill21_pss' O'Neill (2021) using PySulfSat by Wieser & Gleeson (2023) Volcanica 6(1):107-127 doi:10.30909/vol.06.01.107127\n", " 'ONeill22_pss' O'Neill & Mavrogenes (2022) using PySulfSat by Wieser & Gleeson (2023) Volcanica 6(1):107-127 doi:10.30909/vol.06.01.107127\n", " 'Smythe17_pss' Smythe et al. (2017) using PySulfSat by Wieser & Gleeson (2023) Volcanica 6(1):107-127 doi:10.30909/vol.06.01.107127\n", "\n", " SCAS: Model for parameterisation of the sulfate content at anhydrite saturation (S6+CAS).\n", " default: 'Chowdhury19' Eq. (8) using Table 5 in Chowdhury & Dasgupta (2019) Chem.Geol. 522:162-174 doi:10.1016/j.chemgeo.2019.05.020\n", " Other options:\n", " 'Zajacz19' Eq. (8-14) Zajacz & Tsay (2019) GCA 261:288-304 doi:10.1016/j.gca.2019.07.007\n", " 'Liu23' Eq. (4) Liu et al. (2023) GCA 349:135-145 doi:10.1016/j.gca.2023.04.007\n", " 'Zajacz19_pss' Zajacz and Tsay (2019) using PySulfSat by Wieser and Gleeson (2023) Volcanica 6(1):107-127 doi:10.30909/vol.06.01.107127\n", " 'Chowdhury19_pss' Chowdhury & Dasgupta (2019) using PySulfSat by Wieser and Gleeson (2023) Volcanica 6(1):107-127 doi:10.30909/vol.06.01.107127\n", "\n", " sulfur_saturation: Is sulfur allowed to form sulfide or anhydrite if sulfur content of the melt reaches saturation levels for these phases?\n", " default: 'False' melt ± vapor are the only phases present - results are metastable with respect to sulfide and anhydrite if they could saturate.\n", " Other options:\n", " 'True' If saturation conditions for sulfide or anhydrite are met, melt sulfur content reflects this.\n", "\n", " graphite_saturation: Is graphite allowed to form if the carbon content of the melt reaches saturation levels for graphite?\n", " default: 'False' melt ± vapor are the only phases present - results are metastable with respect to graphite if it could saturate.\n", " Other options:\n", " 'True' If saturation conditions for graphite are met, melt carbon content reflects this.\n", "\n", " ### Fugacity coefficients ###\n", "\n", " ideal_gas: Treat all vapor species as ideal gases (i.e., all fugacity coefficients = 1 at all P).\n", " default: 'False' At least some of the vapor species are not treated as ideal gases.\n", " Other options:\n", " 'True' All fugacity coefficients = 1 at all P.\n", "\n", " y_CO2: Model for the parameterisation of the CO2 fugacity coefficient.\n", " default: 'Shi92' Shi & Saxena (1992) AmMin 77(9-10):1038-1049\n", " Other options:\n", " 'Holland91' Holland & Powell (1991) CMP 109:265-273 10.1007/BF00306484\n", " 'ideal' Treat CO2 as ideal gas species, fugacity coefficient = 1 at all P.\n", "\n", " y_SO2: Model for the parameterisation of the SO2 fugacity coefficient.\n", " default: 'Shi92_Hughes23' Fig.S1 Hughes et al. (2023) JGSL 180(3) doi:10.1144/jgs2021-12\n", " Other options:\n", " 'Shi92' Shi & Saxena (1992) AmMin 77(9-10):1038-1049\n", " 'ideal' Treat SO2 as ideal gas species, fugacity coefficient = 1 at all P.\n", "\n", " y_H2S: Model for the parameterisation of the H2S fugacity coefficient.\n", " default: 'Shi92_Hughes24' Fig.S1 Hughes et al. (2024) AmMin 109(3):422-438 doi:10.2138/am-2023-8739\n", " Other options:\n", " 'Shi92' Shi & Saxena (1992) AmMin 77(9-10):1038-1049\n", " 'ideal' Treat H2S as ideal gas species, fugacity coefficient = 1 at all P.\n", "\n", " y_H2: Model for the parameterisation of the H2 fugacity coefficient.\n", " default: 'Shaw64' Eq. (4) from Shaw & Wones (1964) AmJSci 262:918-929\n", " Other options:\n", " 'ideal' Treat H2 as ideal gas species, fugacity coefficient = 1 at all P.\n", "\n", " y_O2: Model for the parameterisation of the O2 fugacity coefficient.\n", " default: 'Shi92' Shi & Saxena (1992) AmMin 77(9-10):1038-1049\n", " Other options:\n", " 'ideal' Treat O2 as ideal gas species, fugacity coefficient = 1 at all P.\n", "\n", " y_S2: Model for the parameterisation of the O2 fugacity coefficient.\n", " default: 'Shi92' Shi & Saxena (1992) AmMin 77(9-10):1038-1049\n", " Other options:\n", " 'ideal' Treat S2 as ideal gas species, fugacity coefficient = 1 at all P.\n", "\n", " y_CO: Model for the parameterisation of the CO fugacity coefficient.\n", " default: 'Shi92' Shi & Saxena (1992) AmMin 77(9-10):1038-1049\n", " Other options:\n", " 'ideal' Treat CO as ideal gas species, fugacity coefficient = 1 at all P.\n", "\n", " y_CH4: Model for the parameterisation of the CH4 fugacity coefficient.\n", " default: 'Shi92' Shi & Saxena (1992) AmMin 77(9-10):1038-1049\n", " Other options:\n", " 'ideal' Treat CH4 as ideal gas species, fugacity coefficient = 1 at all P.\n", "\n", " y_H2O: Model for the parameterisation of the H2O fugacity coefficient.\n", " default: 'Holland91' Holland & Powell (1991) CMP 109:265-273 10.1007/BF00306484\n", " Other options:\n", " 'ideal' Treat H2O as ideal gas species, fugacity coefficient = 1 at all P.\n", "\n", " y_OCS: Model for the parameterisation of the OCS fugacity coefficient.\n", " default: 'Shi92' Shi & Saxena (1992) AmMin 77(9-10):1038-1049\n", " Other options:\n", " 'ideal' Treat OCS as ideal gas species, fugacity coefficient = 1 at all P.\n", "\n", " y_X: Model for the parameterisation of the X fugacity coefficient.\n", " default: 'ideal' Treat X as ideal gas species, fugacity coefficient = 1 at all P.\n", " Only one option available currently, included for future development.\n", "\n", "\n", " ### Equilibrium constants ###\n", "\n", " KHOg: Model for the parameterisation of the equilibiurm constant for H2 + 0.5O2 = H2O.\n", " default: 'Ohmoto97' Reaction (d) in Table 1 from Ohmoto & Kerrick (1977) AmJSci 277:1013-1044\n", " Only one option available currently, included for future development.\n", "\n", " KHOSg: Model for the parameterisation of the equilibiurm constant for 0.5S2 + H2O = H2S + 0.5O2.\n", " default: 'Ohmoto97' Reaction (h) in Table 1 from Ohmoto & Kerrick (1977) AmJSci 277:1013-1044\n", " Other options:\n", " 'no H2S' Stops H2S forming in the vapor (K = 0).\n", "\n", " KOSg: Model for the parameterisation of the equilibiurm constant for 0.5S2 + O2 = SO2.\n", " default: 'Ohmoto97' Reaction (f) in Table 1 from Ohmoto & Kerrick (1977) AmJSci 277:1013-1044\n", " Other options:\n", " 'no SO2' Stops SO2 forming in the vapor (K = 0). As a by-product, OCS will also stop forming.\n", "\n", " KOSg2: Model for the parameterisation of the equilibiurm constant for 0.5S2 + 1.5O2 = SO3.\n", " default: 'ONeill2' Eq. (6b) from O'Neill & Mavrogenes (2022) GCA 334:368-382 doi:10.1016/j.gca.2022.06.020\n", " Only one option available currently, included for future development.\n", "\n", " KOCg: Model for the parameterisation of the equilibiurm constant for CO + 0.5O2 = CO2.\n", " default: 'Ohmoto97' Reaction (c) in Table 1 from Ohmoto & Kerrick (1977) AmJSci 277:1013-1044\n", " Only one option available currently, included for future development.\n", "\n", " KCOHg: Model for the parameterisation of the equilibiurm constant for CH4 + 2O2 = CO2 + 2H2O.\n", " default: 'Ohmoto97' Reaction (e) in Table 1 from Ohmoto & Kerrick (1977) AmJSci 277:1013-1044\n", " Other options:\n", " 'no CH4' Stops CH4 forming in the vapor (K = large number).\n", "\n", " KOCSg: Model for the parameterisation of the equilibiurm constant for OCS.\n", " default: 'Moussallam19' Eq. (8) for 2CO2 + OCS ⇄ 3CO + SO2 in Moussallam et al. (2019) EPSL 520:260-267 doi:10.1016/j.epsl.2019.05.036 for\n", " Other options:\n", " 'no OCS' Stops OCS forming in the vapor (K = large number).\n", "\n", " KCOs: Model for the parameterisation of the equilibiurm constant for Cgrahite + O2 = CO2.\n", " default: 'Holloway92' Eq. (3) KI in Holloway et al. (1992) EuropeanJ.Mineralogy 4(1):105-114.\n", " Only one option available currently, included for future development.\n", "\n", " carbonylsulfide: Reaction equilibrium KOCSg is for.\n", " default: 'COS' 2CO2 + OCS ⇄ 3CO + SO2\n", " Only one option available currently, included for future development.\n", "\n", "\n", " ### Degassing calculation ###\n", "\n", " bulk_composition: Specifying what the inputted melt composition (i.e., dissolved volatiles and fO2-estimate) corresponds to for the degassing calculation\n", " default: 'melt-only' The inputted melt composition (i.e., dissolved volatiles) represents the bulk system - there is no vapor present.\n", " The fO2-estimate is calculated at Pvsat for this melt composition.\n", " Other options:\n", " 'melt+vapor_wtg' The inputted melt composition (i.e., dissolved volatiles) is in equilibrium with a vapor phase.\n", " The amount of vapor as weight fraction gas (wtg) is specified in the inputs. The bulk system composition will be calculated by calculating Pvsat and the vapor composition given the input composition.\n", " 'melt+vapor_initialCO2' The inputted melt composition (i.e., dissolved volatiles) is in equilibrium with a vapor phase.\n", " The initial CO2 content of the melt (i.e., before degassing) is specified in the inputs.\n", " The bulk system composition will be calculated by calculating Pvsat and the vapor composition given the input\n", " composition. The amount of vapor present is calculated using the given initial CO2.\n", "\n", " starting_P: Determing the starting pressure for a degassing calculation.\n", " default: 'Pvsat' Calculation starts at Pvsat for the inputted melt composition (i.e., dissolved volatiles).\n", " Other options:\n", " 'set' Calculation starts at the pressure specified in the inputs (using P_bar, pressure in bars).\n", "\n", " gassing_style: Does the bulk composition of the system (including oxygen) remain constant during the re/degassing\n", " calculation.\n", " default: 'closed' The bulk composition of the system (inc. oxygen) is constant during re/degassing calculation - vapor and melt remain in chemical equilibrium throughout.\n", " Other options:\n", " 'open' At each pressure-step, the vapor in equilibrium with the melt is removed (or added for regassing), such that the bulk composition of the system changes. This does not refer to being buffered in terms of fO2.\n", "\n", " gassing_direction: Is pressure increasing or decreasing from the starting perssure.\n", " default: 'degas' Pressure progressively decreases from starting pressure for isothermal, polybaric calculations (i.e., degassing).\n", " Other options:\n", " 'regas' Pressure progressively increases from starting pressure for isothermal, polybaric calculations (i.e., regassing).\n", "\n", " P_variation: Is pressure varying during the calculation?\n", " default: 'polybaric' Pressure progressively changes during the calculation.\n", " Only one option available currently, included for future development.\n", "\n", " T_variation: Is temperature varying during the calculation?\n", " default: 'isothermal' Temperature is constant during the calculation.\n", " Only one option available currently, included for future development.\n", "\n", " # WHY DID I THINK THIS WAS USEFUL #\n", " eq_Fe: Does iron in the melt equilibrate with fO2.\n", " default: 'yes' Iron equilibrates with fO2\n", " Only one option available currently, included for future development.\n", "\n", " solve_species: What species are used to solve the equilibrium equations?\n", " This should not need to be changed unless the solver is struggling.\n", " default: 'OCS' Guess mole fractions of O2, CO, and S2 in the vapor to solve the equilibrium equations.\n", " 'OHS' Guess mole fractions of O2, H2, and S2 in the vapor to solve the equilibrium equations.\n", " 'OCH' Guess mole fractions of O2, CO, and H2 in the vapor to solve the equilibrium equations.\n", "\n", "\n", " ### Other ###\n", "\n", " density: Model for parameterisation of melt density\n", " default: 'DensityX' DensityX from Iacovino & Till (2019) Volcanica 2(1):1-10 doi:10.30909/vol.02.01.0110\n", " Only one option available currently, included for future development.\n", "\n", " setup: Specifies whether model options are specified in the models or setup dataframe.\n", " default: 'False' All model options are specified in the models dataframe.\n", " Other options:\n", " 'True' Some of the model options are specified in the setup dataframe.\n", "\n", " print status: Specifies whether some sort of status information during the calculation is outputted to let you know progress.\n", " default: 'False' No information about calculation progress is printed.\n", " Other options:\n", " 'True': Some information about calculation progress is printed.\n", "\n", " output csv: Specicies whether a csv of the outputted dataframe is saved at the end of the calculation.\n", " default: 'True' csv is outputted\n", " 'False' csv is not outputted\n", "\n", " high precision: Is high preicision used for calculations?\n", " TRUE OR FALSE WHAT PRECISION IS IT USING\n", " default: 'False' normal precision used for calculations\n", " 'True' high precision used\n", "\n", "\n", " ### In development ###\n", "\n", " For now, just leave them as their default option and everything should work fine!\n", "\n", " isotopes\n", " default: 'no'\n", "\n", " crystallisation\n", " default: 'no'\n", "\n", " mass_volume\n", " default: 'mass'\n", "\n", " calc_sat\n", " default: 'fO2_melt'\n", "\n", " bulk_O\n", " default: 'exc_S'\n", "\n", " error\n", " default: 0.1\n", "\n", " sulfur_is_sat\n", " default: 'no'\n", "\n" ] } ], "source": [ "help(vf.make_df_and_add_model_defaults)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's say I just want to use a different models for S2-CSS and S6+CAS to the defaults of O'Neill (2021) [ONeill21hyd] and Zajacz & Tsay (2019) [Zajacz19], respectively. \n", "\n", "Instead I want to use Fortin et al. (2015) as implemented in PySulfSat (Wieser & Gleeson, 2022) for S2-CSS and Chowdhury & Dasgupta (2019) [Chowdhury19] for S6+CAS. \n", "\n", "I also want to treat S2 as ideal in the vapor." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " option\n", "type \n", "COH_species yes_H2_CO_CH4_melt\n", "H2S_m True\n", "species X Ar\n", "Hspeciation none\n", "fO2 Kress91A\n", "... ...\n", "error 0.1\n", "print status False\n", "output csv True\n", "setup False\n", "high precision False\n", "\n", "[64 rows x 1 columns]\n" ] } ], "source": [ "# choose the options I want - everything else will use the default options\n", "my_models = [['SCSS','Fortin15_pss'],['SCAS','Chowdhury19'],['y_S2','ideal']]\n", "\n", "# turn to dataframe with correct column headers and indexes \n", "my_models = vf.make_df_and_add_model_defaults(my_models)\n", "\n", "# show what the model dataframe looks like\n", "print(my_models)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Run the calculation\n", "\n", "And we can calculate it for a single dataframe - this composition is from Brounce et al. (2014)." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
sampleT ('C)H2OT-eq_wtpcCO2T-eq_ppmwST_ppmwX_ppmwP (bar) sulfS2- SCSSsulfide saturated?DFMQ-sulfide...KHOSg optKOSg optKOSg2 optKCOg optKCOHg optKOCSg optKCOs optcarbonylsulfide optdensity optDate
0Sari15-04-341200.03.831109.01614.120.03515.0324381864.371478True...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 10:08:27.194351
\n", "

1 rows × 67 columns

\n", "
" ], "text/plain": [ "0 sample T ('C) H2OT-eq_wtpc CO2T-eq_ppmw ST_ppmw X_ppmw \\\n", "0 Sari15-04-34 1200.0 3.83 1109.0 1614.12 0.0 \n", "\n", "0 P (bar) sulf S2- SCSS sulfide saturated? DFMQ-sulfide ... KHOSg opt \\\n", "0 3515.032438 1864.371478 True ... Ohmoto97 \n", "\n", "0 KOSg opt KOSg2 opt KCOg opt KCOHg opt KOCSg opt KCOs opt \\\n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "\n", "0 carbonylsulfide opt density opt Date \n", "0 COS DensityX 2025-02-02 10:08:27.194351 \n", "\n", "[1 rows x 67 columns]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Define the melt composition and T as a dictionary.\n", "my_analysis = {'Sample':'Sari15-04-34',\n", " 'T_C': 1200., # Temperature in 'C\n", " 'SiO2': 46.94, # wt%\n", " 'TiO2': 0.65, # wt%\n", " 'Al2O3': 16.0, # wt%\n", " 'FeOT': 8.92, # wt%\n", " 'MnO': 0.15, # wt%\n", " 'MgO': 7.3, # wt%\n", " 'CaO': 13.94, # wt%\n", " 'Na2O': 1.61, # wt%\n", " 'K2O': 0.26, # wt%\n", " 'P2O5': 0.07, # wt%\n", " 'H2O': 3.83, # wt%\n", " 'CO2ppm': 1109., # ppm\n", " 'STppm': 1614.12, # ppm\n", " 'Xppm': 0.} # ppm\n", "\t\t\t\t\t\t\t\t\t\t\t\t\t\n", "# Turn the dictionary into a pandas dataframe, setting the index to 0.\n", "my_analysis = pd.DataFrame(my_analysis, index=[0])\n", "\n", "# run the calculations - just running for a subset of the csv file this time\n", "vf.calc_melt_S_oxybarometer(my_analysis,models=my_models)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Import data and run calculation\n", "\n", "We'll use the examples_marianas_wT csv in files again from Brounce et al. (2014) and Kelley & Cottrell (2012)." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
sampleT ('C)H2OT-eq_wtpcCO2T-eq_ppmwST_ppmwX_ppmwP (bar) sulfS2- SCSSsulfide saturated?DFMQ-sulfide...KHOSg optKOSg optKOSg2 optKCOg optKCOHg optKOCSg optKCOs optcarbonylsulfide optdensity optDate
0TN273-01D-01-0112001.8813362.830478.032446False...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 10:10:00.675419
0TN273-02D-01-0212001.6131314.040458.160784False...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 10:10:00.685169
0Agr07-412006.021891080.1303274.2979892298.668172True...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 10:10:01.120440
0Agr07-912004.4371830.6702590.5293091799.105129True...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 10:10:01.521206
0Agr07-15A12003.54491352.2702143.6880111847.317183True...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 10:10:01.884478
0Agr07-15B12003.422071369.7501574.2241551809.293925True...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 10:10:02.228190
0Agr04-1312003.47405976.902010.3443091508.38486True...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 10:10:02.561960
0Agr04-1412001.961421486.770693.4766891428.429217True0.446233...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 10:10:03.150057
0AGR19-02-412003.256291170.002410.6964361747.031175True...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 10:10:03.524279
0AGR19-02-712002.721421404.001071.1991841635.659539True...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 10:10:03.817342
\n", "

10 rows × 67 columns

\n", "
" ], "text/plain": [ "0 sample T ('C) H2OT-eq_wtpc CO2T-eq_ppmw ST_ppmw X_ppmw \\\n", "0 TN273-01D-01-01 1200 1.88 13 362.83 0 \n", "0 TN273-02D-01-02 1200 1.61 31 314.04 0 \n", "0 Agr07-4 1200 6.02 189 1080.13 0 \n", "0 Agr07-9 1200 4.4 371 830.67 0 \n", "0 Agr07-15A 1200 3.5 449 1352.27 0 \n", "0 Agr07-15B 1200 3.42 207 1369.75 0 \n", "0 Agr04-13 1200 3.47 405 976.9 0 \n", "0 Agr04-14 1200 1.96 142 1486.77 0 \n", "0 AGR19-02-4 1200 3.25 629 1170.0 0 \n", "0 AGR19-02-7 1200 2.72 142 1404.0 0 \n", "\n", "0 P (bar) sulf S2- SCSS sulfide saturated? DFMQ-sulfide ... KHOSg opt \\\n", "0 478.032446 False ... Ohmoto97 \n", "0 458.160784 False ... Ohmoto97 \n", "0 3274.297989 2298.668172 True ... Ohmoto97 \n", "0 2590.529309 1799.105129 True ... Ohmoto97 \n", "0 2143.688011 1847.317183 True ... Ohmoto97 \n", "0 1574.224155 1809.293925 True ... Ohmoto97 \n", "0 2010.344309 1508.38486 True ... Ohmoto97 \n", "0 693.476689 1428.429217 True 0.446233 ... Ohmoto97 \n", "0 2410.696436 1747.031175 True ... Ohmoto97 \n", "0 1071.199184 1635.659539 True ... Ohmoto97 \n", "\n", "0 KOSg opt KOSg2 opt KCOg opt KCOHg opt KOCSg opt KCOs opt \\\n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "\n", "0 carbonylsulfide opt density opt Date \n", "0 COS DensityX 2025-02-02 10:10:00.675419 \n", "0 COS DensityX 2025-02-02 10:10:00.685169 \n", "0 COS DensityX 2025-02-02 10:10:01.120440 \n", "0 COS DensityX 2025-02-02 10:10:01.521206 \n", "0 COS DensityX 2025-02-02 10:10:01.884478 \n", "0 COS DensityX 2025-02-02 10:10:02.228190 \n", "0 COS DensityX 2025-02-02 10:10:02.561960 \n", "0 COS DensityX 2025-02-02 10:10:03.150057 \n", "0 COS DensityX 2025-02-02 10:10:03.524279 \n", "0 COS DensityX 2025-02-02 10:10:03.817342 \n", "\n", "[10 rows x 67 columns]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Read csv to define melt composition\n", "my_analyses = pd.read_csv(\"../files/example_marianas_wT.csv\") \n", "\n", "# run the calculations - just running for a subset of the csv file this time\n", "vf.calc_melt_S_oxybarometer(my_analyses,models=my_models,last_row=10)" ] } ], "metadata": { "kernelspec": { "display_name": "volfe-dev", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.0" } }, "nbformat": 4, "nbformat_minor": 2 }